var e = require("../../utils/config"), t = require("../../utils/request"), r = require("../../utils/api");

Component({
    properties: {
        marginTop: {
            type: String,
            value: "0px"
        }
    },
    data: {
        courseList: []
    },
    lifetimes: {
        attached: function() {
            this.selectWcaIndexLinkCourseByTopNum();
        }
    },
    methods: {
        selectWcaIndexLinkCourseByTopNum: function() {
            var i = this;
            t.request(t.HttpMethod.GET, r.apiRoute.selectIndexWcaCourseCategoryByTopNum, {}).then(function(t) {
                var r = [];
                "20000" == t.code && (t.data.forEach(function(t) {
                    r.push({
                        src: e.courseCategoryImageUrl + t.imageUrl,
                        text: t.name,
                        type: t.code,
                        sort: t.sort
                    });
                }), i.setData({
                    courseList: r
                }));
            });
        }
    }
});